#include "columns.h"

#include <QVariant>

#include "roles.h"


namespace BitWin
{


//---- BitsColumn class

BitsColumn::BitsColumn(
    const QString& title_, const BitRange& range_
):
    Column(title_),
    _range(range_)
{}

QVariant BitsColumn::data(
    int role, const Row* row, const PGenericBitwise& data_
) const
{
    if (BitwiseDataRole == role)
        return row->data(role, _range, data_);
    else
        return QVariant();
}


//---- DisplayColumn class

DisplayColumn::DisplayColumn(const QString& title_, const int role_):
    Column(title_),
    _role(role_)
{}

QVariant DisplayColumn::data(
    int role, const Row* row, const PGenericBitwise& data_
) const
{
    if (Qt::DisplayRole == role)
        return row->data(_role, BitRange(), data_);
    else
        return QVariant();
}


} // BitWin namespace end
